home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Sound / PlayMidi / Source / PlayMidi.s
Text File  |  1999-05-08  |  2KB  |  82 lines

  1. *************************************
  2. *             PlayMidi              *
  3. * for Playing Midi-Files via GMPlay *
  4. *                                   *
  5. *       written by Dirk Busse       *
  6. *            7. May. 1999           *
  7. *************************************
  8.  
  9.  
  10.    INCDIR   include:
  11.  
  12.    include  exec/execbase.i
  13.    include  exec/memory.i
  14.    include  dos/dos.i
  15.    include  LVO.i
  16.  
  17.  
  18.       movea.l  4.w,a6
  19.  
  20.  
  21.       clr.l    d0
  22.       lea      DosName(pc),a1
  23.       jsr      _LVOOpenLibrary(a6)
  24.       movea.l  d0,a5                 ; DosBase to a6
  25.       bne      DosOK
  26.  
  27. Fail  moveq    #RETURN_FAIL,d0
  28.       rts
  29. DosOK
  30.  
  31.       exg.l    a5,a6                 ; DosBase to a6
  32.       jsr      _LVOOutput(a6)
  33.       move.l   d0,d5                 ; Output Handle to d5 (needed later)
  34.       move.l   d0,d1                 ; Output Handle to d1
  35.       move.l   #text,d2
  36.       move.l   #textend-text,d3
  37.       jsr      _LVOWrite(a6)
  38.  
  39.       move.l   #buff,d1
  40.       move.l   #4*64,d2
  41.       clr.l    d3
  42.       jsr      _LVOReadItem(a6)       ; read filename
  43.  
  44.       lea      buff(pc),a4            ; buffer start address to a4
  45. .loop move.b   (a4)+,d1
  46.       bne.b    .loop                  ; search the end of the file name
  47.       move.b   #'"',-(a4)
  48.  
  49.       move.l   #Execute,d1
  50.       clr.l    d2
  51. ;      clr.l    d3
  52.       move.l   d5,d3                 ; Output Handle to d3
  53.       jsr      _LVOExecute(a6)
  54.  
  55.       move.l   #300,d1               ; so IBrowse doesn't delete the file
  56.                                      ; before loading
  57.  
  58.       jsr      _LVODelay(a6)
  59.  
  60.       movea.l  a6,a1                 ; DosBase to a1
  61.       movea.l  a5,a6                 ; ExecBase to a6
  62.       jmp      _LVOCloseLibrary(a6)  ; faster then jsr & rts
  63.  
  64. DosName
  65.       dc.b     "dos.library",0
  66.    EVEN
  67. text
  68.       dc.b     "Playing now Midi file via GMPlay !",$0a
  69. textend
  70.    EVEN
  71. Execute
  72.       dc.b     "failat 21",$0a
  73.       dc.b     "break >NIL: `status command $GMDIR/GMPlay`",$0a
  74.       dc.b     "wait 1",$0a
  75.       dc.b     'run $GMDIR/GMPlay $PlayMidiGMopts  "' ; there are two spaces,
  76. buff  blk.l    64,$0                          ; because blk.l in long aligned
  77. buffend
  78.       dc.b     0,0
  79.  
  80.       dc.b     "$VER: PlayMidi 1.0 (07.05.99)",0
  81.  
  82.